#pragma once

#include <engine.ui/CssError.hpp>




class ErrorModel : public QAbstractItemModel
{
	Q_OBJECT

public:

	typedef std::vector<Error>   Errors;

private:

	QIcon    m_errorIcon;
	Errors   m_errors;

public:

	ErrorModel();



	void add(const Error& e);
	void add(const Errors& e);
	const Errors& errors() const;
	void clear();


	//
	// QAbstractItemModel implementation
	//

	QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
	QModelIndex parent(const QModelIndex& index) const;
	int rowCount(const QModelIndex& parent = QModelIndex()) const;
	int columnCount(const QModelIndex& parent = QModelIndex()) const;
	QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
